#pragma once

#include "ofMain.h"
#include "buttonThread.h"
#include "printThread.h"

class stollenApp : public ofBaseApp{
	
	public:
		
		void setup();
		void update();
		void draw();
		
		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
		void masterButtonPushed();	
		void keepImage();
		void buildBon();
		void replaceAll(std::string& str, const std::string& from, const std::string& to);

		ofVideoGrabber 		vidGrabber;
		ofImage             camImage;
		ofImage             templateImage;
		ofImage             finalImage;

		ofImage             bon1;
		ofImage             bon3;
		ofImage             bon4;
		ofImage             bon4_1;
		ofImage             bon4_2;
		ofImage             bon4_3;
		ofImage             bon4_4;
		ofImage             bon4_5;
		ofImage             bon4_6;
		ofImage             bon4_7;
		ofImage             bon4_8;
		ofImage             bon4_9;
		ofImage             bon4_10;
		ofImage             bon5;
		ofImage             bon6;
		ofImage             bon6_1;
		ofImage             bon6_2;
		ofImage             bon7;

		unsigned char * 	videoInverted;
		ofTexture			videoTexture;
		int 				camWidth;
		int 				camHeight;

		int					bonWidth;
		int					bonHeight;

		int					bon1Height;
		int					bon2Height;
		int					bon3Height;
		int					bon4Height;
		int					bon5Height;
		int					bon6Height;
		int					bon7Height;

		//SOUND
		void audioIn(float * input, int bufferSize, int nChannels); 
	
		vector <float> left;
		vector <float> right;
		vector <float> volHistory;
		
		int 	bufferCounter;
		int 	drawCounter;
		
		float smoothedVol;
		float scaledVol;
		float scaledVolMax;

		ofSoundStream soundStream;

		ButtonThread buttonThread;
		PrintThread printThread;
};


